package day1107.demo02;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-07 09:24
 **/
public class Test {
    public static void main(String[] args) {
        DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse("2020/11/17 22:22:22", dtf);
        System.out.println(dateTime);
    }

    private static void format(){
        LocalDateTime now = LocalDateTime.now();
        System.out.println("转化前的日期时间:"+now);
        DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");

        String format = now.format(dtf);
        System.out.println("转化后:"+format);
    }
}
